package com.ruoyi.customer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.customer.mapper.CarDetailMapper;
import com.ruoyi.customer.domain.CarDetail;
import com.ruoyi.customer.service.ICarDetailService;

/**
 * 购物车细节Service业务层处理
 *
 * @author jtm
 * @date 2024-12-07
 */
@Service
public class CarDetailServiceImpl implements ICarDetailService
{
    @Autowired
    private CarDetailMapper carDetailMapper;

    /**
     * 查询购物车细节
     *
     * @param userId 购物车细节主键
     * @return 购物车细节
     */
    @Override
    public CarDetail selectCarDetailByUserId(Long userId)
    {
        return carDetailMapper.selectCarDetailByUserId(userId);
    }

    /**
     * 查询购物车细节列表
     *
     * @param carDetail 购物车细节
     * @return 购物车细节
     */
    @Override
    public List<CarDetail> selectCarDetailList(CarDetail carDetail)
    {
        return carDetailMapper.selectCarDetailList(carDetail);
    }

    /**
     * 新增购物车细节
     *
     * @param carDetail 购物车细节
     * @return 结果
     */
    @Override
    public int insertCarDetail(CarDetail carDetail)
    {
        carDetail.setCreateTime(DateUtils.getNowDate());
        return carDetailMapper.insertCarDetail(carDetail);
    }

    /**
     * 修改购物车细节
     *
     * @param carDetail 购物车细节
     * @return 结果
     */
    @Override
    public int updateCarDetail(CarDetail carDetail)
    {
        return carDetailMapper.updateCarDetail(carDetail);
    }

    /**
     * 批量删除购物车细节
     *
     * @param userIds 需要删除的购物车细节主键
     * @return 结果
     */
    @Override
    public int deleteCarDetailByUserIds(Long[] userIds)
    {
        return carDetailMapper.deleteCarDetailByUserIds(userIds);
    }

    /**
     * 删除购物车细节信息
     *
     * @param userId 购物车细节主键
     * @return 结果
     */
    @Override
    public int deleteCarDetailByUserId(Long userId)
    {
        return carDetailMapper.deleteCarDetailByUserId(userId);
    }
}
